using System.Data.Linq;

namespace DotNetRepository.LinqToSql
{
    internal class EntityCacheItem <TEntity> 
        where TEntity : class, IEntity
    {
        private readonly TEntity _object;

        internal EntityCacheItem(TEntity obj, DataContext context)
        {
            _object = obj;
            Context = context;
        }

        public TEntity Entity
        {
            get { return _object; }
        }

        public DataContext Context { get; set; }

        public override string ToString()
        {
            return _object.GetType().Name + " (" + _object.ID + ")";
        }
        
    }
}